/*
 * @FileName: loop.c
 * @Author: GreyQiu qiushaogui@aikosolar.com
 * @Date: 2023-07-12 16:05:59
 * @LastEditors: GreyQiu qiushaogui@aikosolar.com
 * @LastEditTime: 2023-08-16 18:08:51
 * @Description: 
 * 
 * Copyright (c) 2023, All Rights Reserved. 
 */

#include "loop.h"

easy_pid_f32_t pid_pv1_vin;
easy_pid_f32_t pid_pv1_iin;
easy_pid_f32_t pid_pv1_vout;

uint16_t loop_en = 0;
float iref_test = 60;

void loop_init(void)
{
    pid_pv1_vin.Ymax = 10.0f;
    pid_pv1_vin.Ymin = 0.0f;
    easy_pid_config(&pid_pv1_vin, 50000, -0.125f, -125.0f, 0);

    pid_pv1_iin.Ymax = 90.0f;
    pid_pv1_iin.Ymin = 0.0f;
    easy_pid_config(&pid_pv1_iin, 50000, 0.95f, 3000.0f, 0);

    pid_pv1_vout.Ymax = 90.0f;
    pid_pv1_vout.Ymin = 0.0f;
    easy_pid_config(&pid_pv1_vout, 50000, 0.3f, 1000.0f, 0);

    pid_pv1_iin.ref = 0.0f;
    pid_pv1_vin.ref = 19.0f;
    pid_pv1_vout.ref = 48.0f;
}
